﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class PageAsyncTaskPage : System.Web.UI.Page
{
localhost.WebService ws = new localhost.WebService();
protected void Page_Load(object sender, EventArgs e)
{
    PageAsyncTask task = new PageAsyncTask(
        new BeginEventHandler(this.BeginCallWebService),
        new EndEventHandler(this.EndCallWebService),
        null,
        null);

    this.RegisterAsyncTask(task);
            
}
private IAsyncResult BeginCallWebService(object sender, EventArgs e, AsyncCallback cb, object extraData)
{
    return ws.BeginHelloWorld(cb, extraData);
}


private void EndCallWebService(IAsyncResult ar)
{
    string time = ws.EndHelloWorld(ar);
    this.Label1.Text = time;
}
}